import request from '@/utils/request'

// 用户登录接口
export interface LoginRequest {
  mobile: string
  password: string
}

export interface LoginResponse {
  code: number
  msg: string
  data: {
    token: string
    userInfo: {
      userId: string
      mobile: string
      nickname?: string
      avatar?: string
    }
  }
}

// 用户API
export const userApi = {
  // 用户登录
  login: (data: LoginRequest) => {
    return request.post<LoginResponse>('/user/user/login', data)
  },

  // 获取用户信息
  getUserInfo: () => {
    return request.get('/user/user/info')
  },

  // 用户注册（如果需要）
  register: (data: any) => {
    return request.post('/user/user/register', data)
  }
}